package com.flying.flow.model;

import java.util.Date;

import com.flying.common.util.Codes;
import com.flying.framework.annotation.ConstantEnum;
import com.flying.framework.annotation.Param;
import com.flying.framework.annotation.Property;
import com.flying.framework.data.Data;
import com.flying.framework.data.DataSerializable;
import com.flying.framework.metadata.Meta;

@SuppressWarnings("serial")
@Meta(id="f_node_instance",title="节点实例", table="f_node_instance", primaryKeys={"node_instance_id"})
public class NodeInstance extends Data implements DataSerializable {
	public final static String ENTITY_NAME = "f_node_instance";

	public final static String NODE_INSTANCE_ID = "node_instance_id";
	public final static String FLOW_INSTANCE_ID = "flow_instance_id";
	public final static String NODE_ID = "node_id";
	public final static String FLOW_DEF_ID = "flow_def_id";
	public final static String FLOW_ID = "flow_id";

	public final static String BUSINESS_CODE = "business_code";
	public final static String ORDER_NO = "order_no";
	public final static String NAME = "name";
	public final static String REMARKS = "remarks";
	public final static String STATUS = "status";
	public final static String EMERGENCY_LEVEL = "emergency_level";
	public final static String PRIORITY_LEVEL = "priority_level";
	public final static String EXPECT_TIME = "expect_time";
	public final static String PLAN_START = "plan_start";
	public final static String PLAN_END = "plan_end";
	public final static String ACTUAL_START = "actual_start";
	public final static String ACTUAL_END = "actual_end";
	public final static String PARTICIPANTS = "participants";
	public final static String CONSUME_SECONDS = "consume_seconds";
	
	public final static String FORM_ACTION = "form_action";
	public final static String FORM_CODE = "form_code";
	public final static String FORM_DATA = "form_data";
	public final static String CREATOR = "creator";
	public final static String CREATE_TIME = "create_time";
	public final static String UPDATOR = "updator";
	public final static String UPDATE_TIME = "update_time";
	
	public enum NodeInstanceStatus implements ConstantEnum<Integer> {
		CREATED(0, "未开始"), PROCESSING(1, "处理中"), SUCCESS(2, "成功"), FAIL(3, "失败"), SEND_BACK(4, "已回退");
		
		public final int type;
		public final String remarks;
		
		NodeInstanceStatus(int type, String remarks) {
			this.type = type;
			this.remarks = remarks;
		}
		@Override
		public Integer value() {
			return type;
		}
		@Override
		public String text() {
			return remarks;
		}
	}
	
	@Param(value=ORDER_NO,   required=false,   maxlength=40,	desc="工单号" )
	private String orderNo;
	
	@Param(value=BUSINESS_CODE,   required=false,   maxlength=10,	desc="业务代码")
	private String businessCode;
	
	@Param(value=ACTUAL_END,   required=false,   maxlength=0,	desc="实际结束时间" )
	private Date actualEnd;
	
	@Param(value=ACTUAL_START,   required=false,   maxlength=0,	desc="实际开始时间" )
	private Date actualStart;
	
	@Param(value=CONSUME_SECONDS,   required=false,   desc="任务耗时" )
	private Integer consumeSeconds;
	
	@Param(value=CREATE_TIME,   required=false,   maxlength=0,	desc="创建时间" )
	private Date createTime;
	
	@Param(value=CREATOR,   required=false,   maxlength=100,	desc="创建人" )
	private String creator;
	
	@Param(value=UPDATE_TIME,   required=false,   maxlength=0,	desc="修改时间" )
	private Date updateTime;
	
	@Param(value=UPDATOR,   required=false,   maxlength=100,	desc="修改人" )
	private String updator;
	
	@Param(value=EMERGENCY_LEVEL,   required=false,   maxlength=0,	desc="紧急程度" )
	private Integer emergencyLevel;
	
	@Param(value=EXPECT_TIME,   required=false,   maxlength=0,	desc="期望完成时间" )
	private String expectTime;
	
	@Param(value=FLOW_DEF_ID,   required=true,   maxlength=0,	desc="流程定义ID" , 
			props= {@Property(name="type",value="hidden")})
	private Long flowDefId;
	
	@Param(value=FLOW_ID,   required=true,   maxlength=0,	desc="流程ID" , 
			props= {@Property(name="type",value="hidden")})
	private Long flowId;
	
	@Param(value=FLOW_INSTANCE_ID,   required=true,   maxlength=0,	desc="流程实例ID", 
			props= {@Property(name="type",value="hidden")} )
	private Long flowInstanceId;
	
	@Param(value=NAME,   required=true,   maxlength=100,	desc="名称" )
	private String name;
	
	@Param(value=NODE_ID,   required=true,   maxlength=0,	desc="节点ID" , 
			props= {@Property(name="type",value="hidden")})
	private Long nodeId;
	
	@Param(value=NODE_INSTANCE_ID,   required=true,   maxlength=0,	desc="节点实例ID" , generator=Codes.AUTO_INCREMENT, 
			props= {@Property(name="type",value="hidden")})
	private Long nodeInstanceId;
	
	@Param(value=PARTICIPANTS,   required=false,   maxlength=100,	desc="执行人" )
	private String participants;
	
	@Param(value=PLAN_END,   required=false,   maxlength=0,	desc="计划结束时间" )
	private Date planEnd;
	
	@Param(value=PLAN_START,   required=false,   maxlength=0,	desc="计划开始时间" )
	private Date planStart;
	
	@Param(value=PRIORITY_LEVEL,   required=false,   maxlength=0,	desc="优先级别" )
	private Integer priorityLevel;
	
	@Param(value=REMARKS,   required=false,   maxlength=1000,	desc="说明" )
	private String remarks;
	
	@Param(value=STATUS,   required=false,   maxlength=0,	desc="状态" )
	private Integer status;
	
	@Param(value=FORM_ACTION,   required=false,   maxlength=50,	desc="表单行为" )
	private String formAction;
	
	@Param(value=FORM_CODE,   required=false,   maxlength=20,	desc="表单代码" )
	private String formCode;
	
	@Param(value=FORM_DATA,   required=false,   maxlength=20,	desc="表单数据" )
	private String formData;
	
	
	public Date getActualEnd() {
		return this.actualEnd;
	}
	
	public void setActualEnd(Date actualEnd) {
		this.actualEnd = actualEnd;
	}
	
	public Integer getConsumeSeconds() {
		return consumeSeconds;
	}

	public void setConsumeSeconds(Integer consumeSeconds) {
		this.consumeSeconds = consumeSeconds;
	}

	public Date getActualStart() {
		return this.actualStart;
	}
	
	public void setActualStart(Date actualStart) {
		this.actualStart = actualStart;
	}
	
	public Date getCreateTime() {
		return this.createTime;
	}
	
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	
	public String getCreator() {
		return this.creator;
	}
	
	public void setCreator(String creator) {
		this.creator = creator;
	}
	
	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getUpdator() {
		return updator;
	}

	public void setUpdator(String updator) {
		this.updator = updator;
	}

	public Integer getEmergencyLevel() {
		return this.emergencyLevel;
	}
	
	public void setEmergencyLevel(Integer emergencyLevel) {
		this.emergencyLevel = emergencyLevel;
	}
	
	public String getExpectTime() {
		return expectTime;
	}

	public void setExpectTime(String expectTime) {
		this.expectTime = expectTime;
	}

	public Long getFlowDefId() {
		return this.flowDefId;
	}
	
	public void setFlowDefId(Long flowDefId) {
		this.flowDefId = flowDefId;
	}
	
	public Long getFlowId() {
		return this.flowId;
	}
	
	public void setFlowId(Long flowId) {
		this.flowId = flowId;
	}
	
	public Long getFlowInstanceId() {
		return this.flowInstanceId;
	}
	
	public void setFlowInstanceId(Long flowInstanceId) {
		this.flowInstanceId = flowInstanceId;
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Long getNodeId() {
		return this.nodeId;
	}
	
	public void setNodeId(Long nodeId) {
		this.nodeId = nodeId;
	}
	
	public Long getNodeInstanceId() {
		return this.nodeInstanceId;
	}
	
	public void setNodeInstanceId(Long nodeInstanceId) {
		this.nodeInstanceId = nodeInstanceId;
	}
	
	public String getParticipants() {
		return this.participants;
	}
	
	public void setParticipants(String participants) {
		this.participants = participants;
	}
	
	public Date getPlanEnd() {
		return this.planEnd;
	}
	
	public void setPlanEnd(Date planEnd) {
		this.planEnd = planEnd;
	}
	
	public Date getPlanStart() {
		return this.planStart;
	}
	
	public void setPlanStart(Date planStart) {
		this.planStart = planStart;
	}
	
	public Integer getPriorityLevel() {
		return this.priorityLevel;
	}
	
	public void setPriorityLevel(Integer priorityLevel) {
		this.priorityLevel = priorityLevel;
	}
	
	public String getRemarks() {
		return this.remarks;
	}
	
	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}
	
	public Integer getStatus() {
		return this.status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getFormAction() {
		return formAction;
	}

	public void setFormAction(String formAction) {
		this.formAction = formAction;
	}

	public String getFormCode() {
		return formCode;
	}

	public void setFormCode(String formCode) {
		this.formCode = formCode;
	}

	public String getFormData() {
		return formData;
	}

	public void setFormData(String formData) {
		this.formData = formData;
	}

	public String getOrderNo() {
		return orderNo;
	}

	public void setOrderNo(String orderNo) {
		this.orderNo = orderNo;
	}

	public String getBusinessCode() {
		return businessCode;
	}

	public void setBusinessCode(String businessCode) {
		this.businessCode = businessCode;
	}
	

}